import React, {Component} from 'react'
class Nav extends Component {
    render() {
        return <div className="nav">
        {
            ['主食', '蔬菜', '豆奶制品'].map((item, key) => 
            <div
            onClick={()=> this.props.switchNav(item)}
            style={{color: this.props.activeNav === item ? 'red' : '#333'}} key={key}>{item}</div>)
        }
    </div>
    }
}
export default Nav